﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.Master" AutoEventWireup="true"
    CodeBehind="ServiceRequest.aspx.cs" Inherits="VSM.ServiceRequest" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <script type="text/javascript">
        function openMultiItemDialog() {
            var tabid = '<%= Request.QueryString["requestType"] %> ';
            javascript: Main.openCustomDialog('../../ItemPopup.aspx?ItemCategory=' + '102', 600, 610, "");
            //window.location.href= 'PartOrder.aspx';
        }

        function openCustomer() {
            var url = "Popup_Customer.aspx?CustomerCode=" + document.getElementById('hf_CustomerCode').value;
            Main.openCustomDialog(url, 650, 470);
        }

        function openVehicle() {
            var url = "Popup_Vehice.aspx?VehicleCode=S";
            Main.openCustomDialog(url, 650, 470);
        }

        function disablePopup(sender, evt) {

            var charCode = (evt.which) ? evt.which : event.keyCode;
            if (charCode == 13)
                return true;

            return true;
        }


        function openDialog(type) {
           
            var url = "rptViewer.aspx?type=" + type + "&GeneralID="+document.getElementById('hf_GeneralID').value;
            Main.openCustomDialog(url, 950, 700);
        }

        function openQuotation() {
            if (document.getElementById('hf_GeneralID').value != "") {
                var url = "P_Quotation.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
                Main.openCustomDialog(url, 950, 700);
            } else
                alert('Please save data first');
        }

        function openLabourCharge() {
            if (document.getElementById('hf_GeneralID').value != "") {
                var url = "Popup_LabourCharge.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
                Main.openCustomDialog(url, 950, 600);
            } else
                alert('Please save data first');
        }

        function openReceptionSheet() {
            if (document.getElementById('hf_GeneralID').value != "") {
                var url = "Popup_ReceptionSheet.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
                Main.openCustomDialog(url, 950, 600);
            } else
                alert('Please save data first');
        }
        function openQuickInspection() {
            if (document.getElementById('hf_GeneralID').value != "") {
                var url = "QuickInspection.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
                Main.openCustomDialog(url, 950, 600);
            } else
                alert('Please save data first');
        }

        function openRepairOrder() {
            if (document.getElementById('hf_GeneralID').value != "") {
                var url = "P_JobCard.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
                Main.openCustomDialog(url, 950, 600);
            } else
                alert('Please save data first');
        }

        function openPartOrder() {
            if (document.getElementById('hf_GeneralID').value != "") {
                var url = "P_PartOrder.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value;
                Main.openCustomDialog(url, 950, 600);
            }
            else 
                alert('Please save data first');
        }

        function openWSC() {
            if (document.getElementById('hf_GeneralID').value != "") {
                var url = "P_WSCA.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value + "&VIN=" + document.getElementById('txt_VIN').value;
                Main.openCustomDialog(url, 950, 600);
            }else alert('Please save data first');
        }

        function openPQR() {
            if (document.getElementById('hf_GeneralID').value != "") {
                var url = "P_PQR.aspx?GeneralID=" + document.getElementById('hf_GeneralID').value + "&VIN=" + document.getElementById('txt_VIN').value;
                Main.openCustomDialog(url, 950, 650);
            } else alert('Please save data first');
        }

        function openServiceHistory() {
            if (document.getElementById('txt_VIN').value != "") {
                var url = "ServiceHistory.aspx?VIN=" + document.getElementById('txt_VIN').value;
                Main.openCustomDialog(url, 950, 650);
            } else alert('Please choose a vehicle first');
        }

        function OpenTechnicalList() {
            var url = "Popup_TechnicalList.aspx?ModelName=" + document.getElementById('txt_VehicleName').value;
            Main.openCustomDialog(url, 800, 610);
        }
    </script>
    <div>
        <asp:UpdatePanel ID="updatePanel" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:HiddenField ID="hf_GeneralID" runat="server" ClientIDMode="Static" />
                <h2>
                    &nbsp;Service</h2>
                <div style="margin-left: 5px; width: 99%;">
                    <hr />
                    <table border="0" width="100%">
                        <tr>
                            <td style="width: 50%">
                                <table border="0" width="100%" style="background-color: #D1D4D8;">
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Date:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txtDate" runat="server" AutoPostBack="True"></asp:TextBox>
                                            <cc1:CalendarExtender ID="txtDate_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                                PopupButtonID="ImageButton1" TargetControlID="txtDate">
                                            </cc1:CalendarExtender>
                                            <asp:ImageButton ID="ImageButton1" runat="Server" AlternateText="Click to show calendar"
                                                ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                            <asp:HiddenField ID="hf_DealerName" runat="server" />
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            VIN:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_VIN" runat="server" Width="70%" ClientIDMode="Static"></asp:TextBox>
                                            <asp:Button ID="btn_SelectVehicle" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                                Height="22px" Text="..." Width="18%" OnClientClick="openVehicle();" />
                                            <asp:HiddenField ID="hf_VehicleID" runat="server" ClientIDMode="Static" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Job ID:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_JobID" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Brand/ Name:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_Brand" runat="server" ClientIDMode="Static" Width="40%"></asp:TextBox>
                                            <asp:TextBox ID="txt_VehicleName" runat="server" ClientIDMode="Static" 
                                                Width="40%"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Receptionist:
                                        </td>
                                        <td class="FormLineItemAlt" valign="top" style="width: 35%">
                                            <asp:TextBox ID="txt_Receptionist" runat="server" Width="90%" Enabled="False"></asp:TextBox>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Engine/ Reg No.</td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_EngineNo" runat="server" Width="40%" ClientIDMode="Static"></asp:TextBox>
                                            <asp:TextBox ID="txt_RegNo" runat="server" ClientIDMode="Static" Width="40%"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Adviser:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:DropDownList ID="ddl_Adviser" runat="server" Width="90%">
                                            </asp:DropDownList>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Model:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_Model" runat="server" Width="40%" ClientIDMode="Static"></asp:TextBox>
                                            <asp:Button ID="btn_TechnicalDoc" runat="server" BackColor="#1B7FC2" 
                                                ForeColor="#FFFFFF" Height="30px" OnClientClick="OpenTechnicalList();"
                                                 Text="Technical Bulletin" Width="130px" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Techinican:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:DropDownList ID="ddl_Technician" runat="server" Width="90%">
                                            </asp:DropDownList>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Color Code:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_ColorCode" runat="server" Width="40%" 
                                                ClientIDMode="Static"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Job Kind:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:DropDownList ID="ddl_JobKind" runat="server" Width="90%">
                                            </asp:DropDownList>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Odometer:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_Odometer" runat="server" Width="40%" ClientIDMode="Static"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Payment:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:DropDownList ID="ddl_Payment" runat="server" Width="90%">
                                            </asp:DropDownList>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Customer Name:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_CustomerName" runat="server" Width="70%" 
                                                ClientIDMode="Static"></asp:TextBox>
                                            <asp:Button ID="btn_SelectCustomer" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                                Height="22px" Text="..." Width="18%" OnClientClick="openCustomer();" />
                                            <asp:HiddenField ID="hf_CustomerCode" runat="server" ClientIDMode="Static" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Date In
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_DateIn" runat="server"></asp:TextBox>
                                            <cc1:CalendarExtender ID="txt_DateIn_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                                PopupButtonID="ImageButton3" TargetControlID="txt_DateIn">
                                            </cc1:CalendarExtender>
                                            <asp:ImageButton ID="ImageButton3" runat="Server" AlternateText="Click to show calendar"
                                                ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                            <asp:TextBox ID="txt_TimeIn" runat="server" Width="60px"></asp:TextBox>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Other Name:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_OtherName" runat="server" Width="90%" 
                                                ClientIDMode="Static"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Exp Delivery Date
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_ExpDate" runat="server"></asp:TextBox>
                                            <cc1:CalendarExtender ID="txt_ExpDate_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                                PopupButtonID="ImageButton4" TargetControlID="txt_ExpDate">
                                            </cc1:CalendarExtender>
                                            <asp:ImageButton ID="ImageButton4" runat="Server" AlternateText="Click to show calendar"
                                                ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                            <asp:TextBox ID="txt_ExpTime" runat="server" Width="60px"></asp:TextBox>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Address:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_Address" runat="server" Width="90%" ClientIDMode="Static"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Start Date:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_StartDate" runat="server"></asp:TextBox>
                                            <cc1:CalendarExtender ID="txt_StartDate_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                                PopupButtonID="ImageButton5" TargetControlID="txt_StartDate">
                                            </cc1:CalendarExtender>
                                            <asp:ImageButton ID="ImageButton5" runat="Server" AlternateText="Click to show calendar"
                                                ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                            <asp:TextBox ID="txt_StartTime" runat="server" Width="60px"></asp:TextBox>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Tel/ Mobile:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_Tel" runat="server" Width="45%" ClientIDMode="Static"></asp:TextBox>
                                            <asp:TextBox ID="txt_Mobile" runat="server" ClientIDMode="Static" Width="40%"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Finish Date:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_FinishDate" runat="server"></asp:TextBox>
                                            <cc1:CalendarExtender ID="txt_FinishDate_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                                PopupButtonID="ImageButton6" TargetControlID="txt_FinishDate">
                                            </cc1:CalendarExtender>
                                            <asp:ImageButton ID="ImageButton6" runat="Server" AlternateText="Click to show calendar"
                                                ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                            <asp:TextBox ID="txt_FinishTime" runat="server" Width="60px"></asp:TextBox>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Tax Code:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_TaxCode" runat="server" Width="90%" ClientIDMode="Static"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Actual Delivery:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_ActualDate" runat="server"></asp:TextBox>
                                            <cc1:CalendarExtender ID="txt_ActualDate_CalendarExtender" runat="server" Format="dd/MM/yyyy"
                                                PopupButtonID="ImageButton7" TargetControlID="txt_ActualDate">
                                            </cc1:CalendarExtender>
                                            <asp:ImageButton ID="ImageButton7" runat="Server" AlternateText="Click to show calendar"
                                                ImageUrl="~/Images/Calendar_scheduleHS.png" />
                                            <asp:TextBox ID="txt_ActualTime" runat="server" Width="60px"></asp:TextBox>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Contact Person:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_ContactPerson" runat="server" Width="45%" 
                                                ClientIDMode="Static"></asp:TextBox>
                                            <asp:TextBox ID="txt_PhoneContact" runat="server" Width="40%" 
                                                ClientIDMode="Static"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Customer Request:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_CustomerRequest" runat="server" Height="53px" TextMode="MultiLine"
                                                Width="90%"></asp:TextBox>
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 15%">
                                            Notice:
                                        </td>
                                        <td class="FormLineItemAlt" style="width: 35%">
                                            <asp:TextBox ID="txt_Notice" runat="server" Height="53px" TextMode="MultiLine" 
                                                Width="90%" ClientIDMode="Static"></asp:TextBox>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <table border="0" width="100%" style="background-color: #D1D4D8;">
                        <tr>
                            <td class="FormLineItem">
                                <asp:Button ID="btn_New" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF" Height="30px"
                                    OnClick="btn_New_Click" Text="New" Width="90px" />
                                <asp:Button ID="btn_Save" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                    Height="30px" OnClick="btn_Save_Click" Text="Save" Width="109px" />
                            </td>
                            <td class="FormLineItem">
                                <asp:Button ID="btn_OpenQuotation" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                    Height="30px" Text="Quotation" Width="100px" 
                                    OnClientClick="openQuotation();" />
                                <asp:Button ID="btn_OpenRepairOrder" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                    Height="30px" OnClientClick="openRepairOrder();" Text="Repair Order" 
                                    Width="100px" />
                                <asp:Button ID="btn_OpenPartOrder" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                    Height="30px" OnClientClick="openPartOrder();" Text="Part Order" 
                                    Width="100px" />
                            </td>
                            <td class="FormLineItem">
                                <asp:Button ID="txt_OpenWSC" runat="server" BackColor="#1B7FC2" 
                                    ForeColor="#FFFFFF" Height="30px" OnClientClick="openWSC();" 
                                    Text="Warranty Claim" Width="100px" />
                            </td>
                        </tr>
                        <tr>
                            <td class="FormLineItem">
                                <asp:Button ID="btn_LabourCharge" runat="server" BackColor="#1B7FC2" 
                                    ForeColor="#FFFFFF" Height="30px" OnClientClick="openLabourCharge();" 
                                    Text="Labour Charge" Width="100px" />
                                <asp:Button ID="btn_OpenServiceHistory" runat="server" BackColor="#1B7FC2" 
                                    ForeColor="#FFFFFF" Height="30px" OnClientClick="openServiceHistory();" 
                                    Text="Service History" Width="100px" />
                            </td>
                            <td class="FormLineItem">
                                <asp:Button ID="btn_ReceptionSheet" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                    Height="30px" Text="Reception Sheet" Width="100px" 
                                    OnClientClick="openReceptionSheet();" />
                                <asp:Button ID="btn_ReceptionSheet0" runat="server" BackColor="#1B7FC2" 
                                    ForeColor="#FFFFFF" Height="30px" OnClientClick="openQuickInspection();" 
                                    Text="Quick Inspection" Width="100px" />
                                <asp:Button ID="btn_OpenPartOrder0" runat="server" BackColor="#1B7FC2" 
                                    ForeColor="#FFFFFF" Height="30px" OnClientClick="openInvoice();" 
                                    Text="Invoice" Width="100px" />
                            </td>
                            <td class="FormLineItem">
                                <asp:Button ID="txt_OpenQPR" runat="server" BackColor="#1B7FC2" 
                                    ForeColor="#FFFFFF" Height="30px" OnClientClick="openPQR();" 
                                    Text="Quality Product" Width="100px" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="3" class="FormLineItem">
                                <asp:Button ID="btn_AddMultiItems" Text="Add Part" BackColor="#1B7FC2" runat="server"
                                    ForeColor="#FFFFFF" Height="30px" Width="90px" OnClick="btn_AddMultiItems_Click" />
                                <asp:DropDownList ID="ddl_Model" runat="server" Width="170px">
                                </asp:DropDownList>
                                <asp:DropDownList ID="ddl_Package" runat="server" Width="170px">
                                </asp:DropDownList>
                                <asp:Button ID="btn_ImportPackage" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                    Height="30px" OnClick="btn_ImportPackage_Click" Text="Import Service Package"
                                    Width="150px" />
                                <asp:FileUpload ID="fu_ImportExcel" runat="server" Width="219px" 
                                    Visible="False" />
                                <asp:Button ID="btn_ImportExcel" runat="server" BackColor="#1B7FC2" ForeColor="#FFFFFF"
                                    Height="30px" OnClick="btn_ImportExcel_Click" Text="Import Excel" 
                                    Width="150px" Visible="False" />
                            </td>
                        </tr>
                    </table>
                     <div style="width: 100%">
                    <table border="0" width="100%" style="background-color: #D1D4D8;">
                        <asp:GridView ID="grvPO" CssClass="GridInner" runat="server" Width="100%" BorderColor="White"
                            BackColor="White" AllowSorting="True" AutoGenerateColumns="False" CellPadding="2"
                            HeaderStyle-Height="27px" OnRowCreated="grvPO_RowCreated" CellSpacing="2" OnRowEditing="EditItem"
                            OnRowUpdating="UpdateItem" HeaderStyle-VerticalAlign="Middle" OnRowCancelingEdit="CancelEdit"
                            AllowPaging="True" OnPageIndexChanging="grvSearchResult_PageIndexChanging" PageSize="20"
                            OnRowDeleting="DeleteItem" OnRowDataBound="grvSearchResult_RowDataBound">
                             <PagerSettings Mode="NumericFirstLast" />
                            <PagerStyle BackColor="#70A0D0" Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Middle" />
                            <RowStyle BackColor="#D9E0ED" BorderColor="White" BorderWidth="2px" Height="25px" />
                            <AlternatingRowStyle BackColor="#EEF1F7" BorderColor="White" BorderWidth="2px" />
                            <Columns>
                                <asp:CommandField HeaderText="Action" ShowDeleteButton="True" ShowEditButton="False"
                                    Visible="false" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    ItemStyle-Width="70px" />
                                <asp:TemplateField HeaderText="Action">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:LinkButton ID="lnkDelete" runat="server" Text="Delete"  OnClick="lnkDelete_Click"></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="#">
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemTemplate>
                                        <asp:Label ID="lb_No" runat="server" Text='<%# Bind("No") %>' BorderStyle="none">

                                        </asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Code">
                                    <ItemStyle HorizontalAlign="Left" Width="10px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lb_DetailCode" runat="server" Text='<%# Bind("DetailCode") %>' ></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Part NBR">
                                    <ItemStyle HorizontalAlign="Left" Width="100px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_ItemCode" runat="server" Text='<%# Bind("ItemCode") %>' OnTextChanged="TextBox_Change" AutoPostBack="true"
                                           ></asp:TextBox>
                                    </ItemTemplate>
                                </asp:TemplateField>

                                <asp:TemplateField HeaderText="Part Name">
                                    <ItemStyle HorizontalAlign="Left" Width="250px" />
                                    <HeaderStyle VerticalAlign="Middle" Font-Bold="true" />
                                    <ItemTemplate>
                                        <asp:Label ID="lb_ItemName" runat="server" Text='<%# Bind("ItemName") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="VN Name">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Left" Width="250px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lb_FrgnName" runat="server" Text='<%# Bind("FrgnName") %>' BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Quantity">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Right" Width="50px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_Qty" runat="server" Width="97%" Text='<%# String.Format("{0:N}", Eval("Quantity")) %>'
                                            AutoPostBack="true" OnKeyPress="return isNumberKey(this, event);" style="text-align: right"
                                            OnTextChanged="txtOrderQuantity_OnTextChanged" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Price">
                                    <HeaderStyle VerticalAlign="Middle" />
                                    <ItemStyle HorizontalAlign="Right" Width="70px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lb_Price" runat="server" Text='<%# String.Format("{0:N}", Eval("Price")) %>'
                                            BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="VAT">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="70px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lb_Vat" Width="100%" runat="server" Text='<%# String.Format("{0:N}", Eval("VAT")) %>'
                                            BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Discount">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="70px" />
                                    <ItemTemplate>
                                        <asp:TextBox ID="txt_DiscPrcnt" Width="100%" style="text-align: right" runat="server"
                                            Text='<%#  String.Format("{0:N}", Eval("DiscPrcnt")) %>' AutoPostBack="true"
                                            OnKeyPress="return isNumberKey(this, event);" OnTextChanged="txt_Discount_OnTextChanged" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="P. Stock">
                                    <ItemStyle HorizontalAlign="Right" />
                                    <HeaderStyle VerticalAlign="Middle" Width="50px" />
                                    <ItemTemplate>
                                        <asp:Label ID="lb_Stock" runat="server" Width="100%"  Text='<%#  String.Format("{0:N}", Eval("Stock")) %>'
                                            BorderStyle="none" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                           <HeaderStyle BackColor="#6095C9" Font-Bold="true" ForeColor="#ffffff" Font-Overline="False"
                                Height="27px" VerticalAlign="Bottom" />
                        
                        </asp:GridView>
                    </table>
                    </div>
                </div>

                <table width="100%" border="0">
                    <tr>
                           <td class="FormLineItemAlt" align="right"> 
                           <table width= "300px">
                                <tr>
                                        <td class="FormLineItemAlt" 
                                            style="width:50%; font-weight: bold; color: #3366AA;">
                                            Sub Total:</td>

                                         <td class="FormLineItemAlt" align="right" style="width:50%; font-weight: bold; color: #3366AA;">
                                             <asp:Label ID="lb_SubTotal" runat="server" Text="0"></asp:Label>
                                        </td>
                                </tr>
                                <tr>
                                        <td class="FormLineItemAlt"  style="width:50%; font-weight: bold; color: #3366AA;">
                                            VAT Amount:</td>

                                         <td class="FormLineItemAlt"  align="right" style="width:50%; font-weight: bold; color: #3366AA;">
                                             <asp:Label ID="lb_VATAmount" runat="server" Text="0"></asp:Label>
                                        </td>
                                </tr>
                                 <tr>
                                        <td class="FormLineItemAlt"  style="width:50%; font-weight: bold; color: #3366AA;">
                                            Discount Amount:</td>

                                         <td class="FormLineItemAlt"  align="right" style="width:50%; font-weight: bold; color: #3366AA;">
                                             <asp:Label ID="lb_DiscountAmt" runat="server" Text="0"></asp:Label>
                                        </td>
                                </tr>

                                <tr>
                                        <td class="FormLineItemAlt"  style="width:50%; font-weight: bold; color: #3366AA;">
                                            Grand Total:</td>

                                         <td class="FormLineItemAlt"  align="right" style="width:50%; font-weight: bold; color: #3366AA;">
                                             <asp:Label ID="lb_GrandTotal" runat="server" Text="0"></asp:Label>
                                        </td>
                                </tr>
                           </table>
                            </td>
                           
                    </tr>
                </table>
                <table width="100%" border="0">
                    <tr>
                        <td>
                            <table style="width: 100%">
                                <tr>
                                    <td>
                                        <asp:Label ID="lblError" runat="server" Visible="true" Font-Bold="True" ForeColor="Red"></asp:Label>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </ContentTemplate>
            <Triggers>
                <%--<asp:PostBackTrigger ControlID="btn_TechnicalDoc" />--%>
                <asp:PostBackTrigger ControlID="btn_ImportExcel" />
            </Triggers>
        </asp:UpdatePanel>
    </div>
</asp:Content>
